import {reqSongListDetail,reqSong} from "@/http/api";

export default {
    namespaced: true,//开启命名空间
    state: {
        playList:{},
        songList:{},
        TopSongLists:{}
    },
    mutations: {
        GET1(state,data){
            state.playList = data.playlist;
            state.songList = data;
        },
        GET2(state,data){
            state.TopSongLists = data.songs;
        },
    },
    actions: {
        async getPlayList({commit},id){
            let result = await reqSongListDetail(id);
            commit('GET1',result.data)

let resultData = result.data.privileges || []
            let s = "";
            for(let i = 0;i < resultData.length;i++){
                s += result.data.privileges[i].id;
                if(i !== result.data.privileges.length-1)
                    s += ",";
            }
            // let result2 = await reqSong(s);//排行榜歌曲
            // commit('GET2',result2.data)
        },
    },
    getters: {

    }
}
